package org.act.xservices.rt.xcontainer.framework.config;

import java.io.File;
import java.io.FileInputStream;

import org.act.xservices.rt.metaset.Metaset;
import org.act.xservices.rt.metaset.MetasetBuilderFactory;

public class ConfigElementParser {

	public static IConfigElement parseConfigFile(String filename){

		try {
			File configFile = new File(filename);
			FileInputStream configFileInStream = new FileInputStream(configFile);
			Metaset xmlMetaSet = 
				MetasetBuilderFactory.newInstance().getMetasetBuilder().parse(configFileInStream);
			configFileInStream.close();
			
			return new ConfigElementMetasetImpl(xmlMetaSet);
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		}
	}
	
	
	public static IConfigElement creatConfigElement( Metaset xmlMetaset ){
			
		return new ConfigElementMetasetImpl(xmlMetaset);

	}
	
}
